package com.zdlog.ler.Resp.util;

import com.zdlog.ler.Resp.object.ResponeMessage;

public class ResponeMessageUtil {

    public static ResponeMessage success(Object object) {
        ResponeMessage responeMessage = new ResponeMessage();
        responeMessage.setData(object);
        responeMessage.setCode(0);
        responeMessage.setMsg("成功");
        return responeMessage;
    }

    public static ResponeMessage success(String msg) {
        ResponeMessage responeMessage = new ResponeMessage();
        responeMessage.setCode(0);
        responeMessage.setMsg(msg);
        return responeMessage;
    }

    public static ResponeMessage success() {
        return success(null);
    }

    public static ResponeMessage error( String msg) {
        ResponeMessage responeMessage = new ResponeMessage();
        responeMessage.setCode(401);
        responeMessage.setMsg(msg);
        return responeMessage;
    }



    public static ResponeMessage error(Integer code, String msg) {
        ResponeMessage responeMessage = new ResponeMessage();
        responeMessage.setCode(code);
        responeMessage.setMsg(msg);
        return responeMessage;
    }


    /**
     * 参数异常
     * @return
     */
    public static ResponeMessage PARAMETER_ERROR() {
        ResponeMessage responeMessage = new ResponeMessage();
        responeMessage.setCode(401);
        responeMessage.setMsg("参数异常");
        return responeMessage;
    }


    public static ResponeMessage NOT_FOUND_USER() {
        ResponeMessage responeMessage = new ResponeMessage();
        responeMessage.setCode(0);
        responeMessage.setMsg("无此用户");
        return responeMessage;
    }

    public static ResponeMessage REGISTER_SUCCESS() {
        return success("注册成功");
    }
    public static ResponeMessage REGISTER_FAIL() {
        return success("注册失败");
    }

    public static ResponeMessage LOGIN_SUCCESS() {
        return success("登录成功");
    }
    public static ResponeMessage LOGIN_FAIL() {
        return error("登录失败");
    }

    public static ResponeMessage USER_IS_HAVE() {
        return success("用户已注册");
    }

    public static ResponeMessage LOGOUT_SUCCESS() {
        return success("退出登录成功");
    }
    public static ResponeMessage SEND_EMAIL_FREQUENTLY() {
        return error("验证请求过于频繁，1分钟内1次");
    }


}
